﻿Type=Activity
Version=6
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.

	Private addresslbl As Label
	Private kcdate As Label
	Private lblkccontent As Label
	Private paddress As Panel
	Private teacherheaderriv As ImageView
	Private teachernamelbl As Label
	Private teacherprice As Label
	Private curkc As kcItem
'	Private kcid As Int
	Dim tec As Teacher
	Private cscls As customerserviceCLS
	Dim usertel As String
	Private btnleft As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim telaw As telanywhere
telaw.Initialize(Activity)

	'Do not forget to load the layout file created with the visual designer. For example:
	Activity.LoadLayout("laykcdetail")
	initviews
End Sub
Private Sub reqnewkc
	comm.showProgress("正在获取数据")
	ParseHelper.doGetReq(Me,"kcxq",comm.getApi(comm.apiIdx.REQKECHENLIST),Array As String("trd_id",curkc.trdid))
End Sub
Sub initviews
	curkc=g_store.Get("curkc")
	comm.setFA(btnleft,"fa-angle-left","")
'	kcid=g_store.get("kcid")
	cscls.Initialize(Activity)
	reqnewkc
	comm.loadimground(comm.S_TESTTEACHERHEADER,teacherheaderriv,0,0)
End Sub
Private Sub parseKCDetail(str As String)
	Dim parser As JSONParser 
	parser.Initialize(str) 
	Dim root As Map = parser.NextObject 
	Dim data As List = root.Get("data") 
	tec.Initialize
	For Each coldata As Map In data 
	    Dim image As String = coldata.Get("image") 
	    Dim sd_start_time As String = coldata.Get("sd_start_time") 
	    Dim finished_time As String = coldata.Get("finished_time") 
	    Dim kc_title As String = coldata.Get("kc_title") 
	    Dim tuikuan_time As String = coldata.Get("tuikuan_time") 
	    Dim sex As String = coldata.Get("sex") 
	     usertel= coldata.Get("usertel") 
	    Dim sd_mode As String = coldata.Get("sd_mode") 
	    Dim sd_hour As String = coldata.Get("sd_hour") 
	    Dim trd_id As String = coldata.Get("trd_id") 
	    Dim sd_money As String = coldata.Get("sd_money") 
	    Dim js_y As String = coldata.GetDefault("js_y","") 
    	Dim js_x As String = coldata.GetDefault("js_x","") 
	    Dim sd_end_time As String = coldata.Get("sd_end_time") 
	    Dim fl_title As String = coldata.Get("fl_title") 
	    Dim riqi As String = coldata.Get("riqi") 
	    Dim id As String = coldata.Get("id") 
	    Dim add_time As String = coldata.Get("add_time") 
		Dim kc_grade As String = coldata.Get("kc_grade") 
	    Dim kc_address As String = coldata.Get("kc_address") 
	    Dim order_sn As String = coldata.Get("order_sn") 
	    Dim status As String = coldata.Get("status") 
	    Dim username As String = coldata.Get("username") 
		tec.nickname=username
		tec.mobile=usertel
		tec.lng=js_x
		tec.lat=js_y
		comm.loadimground(comm.combinPic(image),teacherheaderriv,0,0)
		teachernamelbl.Text=fl_title&" "&username
		lblkccontent.Text=kc_grade&" "&fl_title&" "&sd_mode
		kcdate.Text=riqi&" "&sd_start_time&"-"&sd_end_time
		teacherprice.Text=status
		addresslbl.Text="上课地址:"&kc_address
		
	Next 
	Dim status As String = root.Get("status") 

End Sub
Sub JobDone(thj As HttpJob)
	ProgressDialogHide
	If thj.Success Then
		Dim str As String=thj.GetString
		Dim nr As netRes=ParseHelper.getStatusData(str)
		If nr.nCode=200 Then
			parseKCDetail(str)
		Else
			comm.TL("错误:"&nr.sData)
		End	 If
	Else
		comm.TL(thj.JobName&"网络错误:"&thj.ErrorMessage)
	End If
	thj.Release
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub ivback_Click
	Activity.Finish
End Sub

Sub ivxuke_Click
	
End Sub

Sub ivtel_Click
	If usertel.Length>10 Then	comm.calltel(usertel) Else comm.T("没有获取到教师电话号码")
End Sub

Sub ivchat_Click
	cscls.startChatToTecDirectly(tec)
End Sub

Sub btntousu_Click
	cscls.callCommonCustomService
End Sub

Sub btnchatassist_Click
	cscls.callCommonCustomService
End Sub

Sub btncancelkc_Click
	Dim res As Int=Msgbox2("确定要取消课程吗?","取消课程","取消","不取消","",Null)
	If res==DialogResponse.POSITIVE Then
		'Activity.Finish
		ToastMessageShow("取消了",False)
	Else
		ToastMessageShow("没取消",False)
	End If
End Sub

Sub paddress_Click
	If tec.lat.Length<1 Or tec.lng.Length<1 Then
		comm.TL("该教师无详细地址")
		Return
	End If
	Dim marker As clsAMap2DCaller
	marker.Initialize
	marker.BiaoZhuSingle(tec,"查看地址")
End Sub